import React, { useState, useEffect } from 'react'

export default function App() {
  const [count, setCount] = useState(10)
  useEffect(() => {
    setInterval(() => {
      // setCount(count - 1)
      // debugger
      console.log(count) // ?
      /* setCount(function fn(count) {
        // debugger
        return count - 1
      }) */
      setCount((count) => count - 1)
    }, 1000)
  }, [])
  return <div>{count}</div>
}
